Skip to content

fix: potential wrap in RGB API - #129

Merged
dloebl merged 1 commit into
mainfrom
fix-rgb-mean-calc-wrap
Sep 2, 2026
Merged

fix: potential wrap in RGB API#129
dloebl merged 1 commit into
mainfrom
fix-rgb-mean-calc-wrap

Conversation

@dloebl

@dloebl dloebl commented Sep 2, 2026

Copy link
Copy Markdown
Owner

There is a potential wrap in the experimental cgif RGB API (not included in a release) affecting very large encodings with few colors.

ASAN output:

==19382==ERROR: AddressSanitizer: BUS on unknown address (pc 0x00018b6cd520 bp 0x00016d85ba70 sp 0x00016d85b220 T0)
==19382==The signal is caused by a WRITE memory access.
==19382==Hint: this fault was caused by a dereference of a high value address (see register values below).  Disassemble the provided pc to learn which register was used.
    #0 0x00018b6cd520 in _platform_memmove+0x1c0 (libsystem_platform.dylib:arm64e+0x3520)
    #1 0x0001025a93d0 in crawl_decision_tree+0x7a4 (a.out:arm64+0x1000093d0)
    #2 0x0001025a6774 in create_decision_tree+0x180 (a.out:arm64+0x100006774)
    #3 0x0001025a3f10 in quantize_and_dither+0x1d4 (a.out:arm64+0x100003f10)
    #4 0x0001025a2e34 in cgif_rgb_addframe+0xdfc (a.out:arm64+0x100002e34)
    #5 0x0001025a0cec in main+0x50c (a.out:arm64+0x100000cec)
    #6 0x00018b2f84e0 in start+0x1b4c (dyld:arm64e+0x204e0)

Credits to Ulfar Erlingsson for disclosing this issue to me.

@dloebl
dloebl merged commit b68f18a into main Sep 2, 2026
15 checks passed
@dloebl
dloebl deleted the fix-rgb-mean-calc-wrap branch September 2, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants